//<!-- 组合属性注入 -->
package date1128.db;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.lu.jdog.util.Resource;

import dog.db.BaseDBHelper;

/**
 * @author Yue
 * @date 2017年11月28日 上午11:28:31 
 */
public class SpringTest {
	private static ApplicationContext applicationContext;
	public static void main(String[] args) throws SQLException {
		applicationContext = new ClassPathXmlApplicationContext(Resource.getAssertPath(BaseDBHelper.class,"beans.xml"));
		
		BaseDBHelper dbHelper = applicationContext.getBean("dbHelper",BaseDBHelper.class);
		dbHelper.open();
		ResultSet result = dbHelper.query("select * from news");
		List<News> newList = new ArrayList<>();
		
		while (result.next()) {
			newList.add(new News(result.getString(1),result.getString(2)));
		}
		System.out.println(newList.toString());
		
		
		
}
}
